/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.agh.air.bpel2bpmn.comparator.impl;

import org.agh.air.bpel2bpmn.comparator.AbstractComparator;
import org.agh.air.bpel2bpmn.exception.PatternNotFoundException;
import org.w3c.dom.Node;

/**
 *
 * @author paletz
 */
public class SwitchComparator extends AbstractComparator{

   /*        <switch>
                <case condition="">
                    <sequence>
                        <invoke name="Task-13189" partnerLink="" portType="" operation="" inputVariable="" outputVariable=""/>

                        <assign name="Gateway-13201_set_noDefault">
                            <copy>
                                <from expression="true"/>
                                <to variable="Gateway-13201_noDefaultRequired" part="noDefault"/>
                            </copy>
                        </assign>
                    </sequence>
                </case>
                <otherwise>
                    <empty/>
                </otherwise>
            </switch>
   */

    @Override
    public String compare(Node node) throws PatternNotFoundException {
        if(node.getNodeName().equals(SWITCH)) {
            String str ="switch"+ LTMP;
            
            for(int i=0; i < node.getChildNodes().getLength(); i++){
                     str = str + getIChild(node, i).getNodeName();
                
                if(i != node.getChildNodes().getLength()-1){
                    str = str + ".";
                }
            }
            
            
            return str + RTMP;    
        }
            
        
        throw new PatternNotFoundException();
    }
    
}
